<%@ page language="java"  import="java.sql.*" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" href="calendarview.css">
	<script src="js/prototype.js"></script>
    <%HttpSession sesja = request.getSession(true);
    if(sesja.getAttribute("lang").equals("en")){%><script src="js/calendarviewEN.js"></script>    
    <%}else{%><script src="js/calendarviewPL.js"></script><%}%>    
    <script>
      Event.observe(window, 'load', function() { setupCalendars()});
    </script>
</head>
<body>
<div class=glowna>
<table>
<tr>
<td valign="top" width=70%>
		<table cellspacing=30>
		<tr>
			<td>		
				<%		
				int jezyk; 
				if(sesja.getAttribute("lang").equals("en"))jezyk=1;
				else jezyk=0;
				String wynik = "";
				try {
					Connection con = mb.commons.DbConnection.getConnection();
				 	Statement stmt = con.createStatement();
					ResultSet rs = stmt.executeQuery("SELECT p.imie, p.nazwisko, n.data_dodania, n.tresc FROM pracownicy p, newsy n WHERE p.id_pracownika=n.id_pracownika AND n.jezyk='"+jezyk+"' ORDER BY `data_dodania` DESC LIMIT 5");
				    while(rs.next()){
				    	wynik+="<fieldset class=obrys><div class=news><div class=news_tekst>"+rs.getString("tresc")+"</div><div class=autor>Autor: "+rs.getString("imie")+" "+rs.getString("nazwisko")+"</div><div class=data>Data: "+rs.getString("data_dodania")+"</div></div></fieldset><div class=kreska_pozioma></div>";
				    }
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				out.write(wynik);	
				%>
			</td>			
		</tr>
		</table>
</td>
<td valign="top" width="1px" ><div class='kreska'></div></td>
<td valign="top" width=29%>
	<fieldset class=obrys style='margin-top:30px;'>
		<table class=opcje>
		<tr>
		<td align="center" valign="middle"> 
			<table width=100%>
		<%if(sesja.getAttribute("lang").equals("en")){%>  
				<tr>
					<td colspan="2"><center>Today is:</center><br><br><div id="embeddedCalendar" style="margin-left: auto; margin-right: auto"></div><br></td>
				</tr>			
				<tr>
					<td colspan="2"><embed src="images/zegar.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" width="100%" height="100%"></embed></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/paczka.png"/ height=50px width=50px></td><td valign="middle"><a href="index.jsp?add=track">Track Shipment</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/support.png"/ height=50px width=50px></td><td><a href="index.jsp?add=kontakt">Need help ?</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/facebook.png"/ height=50px width=50px></td><td><a href="http://www.facebook.com/pages/ELS-Find-your-way/343316169017161">Find us on Facebook</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/koperta.png"/ height=50px width=50px></td><td><a href="index.jsp?add=els">Meet ELS</a></td>
				</tr>
			<%}else{ %>
				<tr>
					<td colspan="2"><center>Dzisiaj jest:</center><br><br><div id="embeddedCalendar" style="margin-left: auto; margin-right: auto"></div><br></td>
				</tr>			
				<tr>
					<td colspan="2"><embed src="images/zegar.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" width="100%" height="100%"></embed></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/paczka.png"/ height=50px width=50px></td><td valign="middle"><a href="index.jsp?add=track">Śledź paczkę</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/support.png"/ height=50px width=50px></td><td><a href="index.jsp?add=kontakt">Zasięgnij pomocy</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/facebook.png"/ height=50px width=50px></td><td><a href="http://www.facebook.com/pages/ELS-Find-your-way/343316169017161">Znajdź nas na Facebook'u</a></td>
				</tr>
				<tr>
					<td valign="middle"><img src="images/koperta.png"/ height=50px width=50px></td><td><a href="index.jsp?add=els">Odkryj ELS</a></td>
				</tr>
			<%} %>
			</table>
		</td>
		</tr>
		</table>
		</fieldset>	
</td>
</tr>
</table>
</div>
</body>
</html>